home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cutils.arc / SM.ASM < prev    next >
Encoding:
Assembly Source File  |  1985-08-30  |  2.6 KB  |  68 lines

  1.                 PAGE            65,132
  2.                 TITLE           The stripped down Lattice Header.
  3.                 NAME            Main
  4. ; ---------------------------------------------------------------------
  5. ; Author:  Jonathan Wesener
  6. ; Date:    3 / 14 / 85
  7. ; Purpose: This header will allow us to assemble, compile and link
  8. ;       our programs into .COM format and also got rid of the 10K of
  9. ;       garbage that LATTICE used to add.
  10.  
  11. LF              EQU     0ah
  12.  
  13. PGROUP          GROUP   BASE,PROG,TAIL
  14.  
  15. ; BASE is included because its alphabetically less than DATA so the linker
  16. ; will put the data after the code and allow us to generate a .COM
  17.  
  18. BASE            SEGMENT BYTE PUBLIC 'PROG'
  19.                 ASSUME  CS:PGROUP
  20.                 EXTRN   MAIN:NEAR
  21.                 EXTRN   PRINTE:NEAR
  22.                 ORG     100H
  23.  
  24. ; We compute the segment ourselves because if we let the linker figure it
  25. ; out, like     MOV     AX,DGROUP       , the loader would have to update
  26. ; our code, hence it would not be .COM compatable.
  27.  
  28. C               PROC    NEAR
  29.                 mov     ax,offset PGROUP:TAIL
  30.                 mov     cl,4            ; compute the number of
  31.                 shr     ax,cl           ; paragraphs away the data segment
  32.                 mov     bx,cs           ; compute the data segment
  33.                 add     ax,bx           ; by adding offset to base
  34.                 mov     ds, ax
  35.                 mov     es, ax
  36.                 mov     ss, ax
  37.                 mov     sp, offset stack + stacksize
  38.                 cld                     ; set correct direction of the stack
  39.                 call    main
  40.                 mov    ah, 4ch
  41.                 int    21h
  42.                 int    20h
  43. C               ENDP
  44. BASE            ENDS
  45.  
  46. PROG            SEGMENT         BYTE PUBLIC 'PROG'
  47. PROG            ENDS
  48.  
  49. ; I set the alignment to paragraph because TAIL is empty.  The TAIL segment
  50. ; will then be the same thing as the DATA segment and we don't need to
  51. ; compute the segment address .
  52.  
  53. TAIL            SEGMENT         PARA 'PROG'
  54. TAIL            ENDS
  55.  
  56. DGROUP          GROUP   DATA, LAST
  57. DATA            SEGMENT         PARA PUBLIC 'DATA'
  58. STACKSIZE       EQU     200                  ; a 800 byte stack
  59.  
  60.                 db    "(C) Copyright 1985, BEYOND CONTROL Software." 
  61.                 db      " Jonathan Wesener."
  62. stack           db      STACKSIZE dup ("$")     ; buffer for output
  63. DATA            ENDS
  64.  
  65. LAST            SEGMENT         PARA PUBLIC 'DATA'
  66. LAST            ENDS
  67.                 END     C               ; Tells where the start of the code is
  68.